﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SampleAPIService
{
    public class UserStore
    {
        private static List<User> _users = new List<User>() {
        new User {  Id=1, Name="alice", Password="alice", Role="Operator", Email="alice@gmail.com", PhoneNumber="18800000001", Birthday=DateTime.Now },
        new User {  Id=2, Name="bob", Password="bob", Role="Operator", Email="bob@gmail.com", PhoneNumber="18800000002", Birthday=DateTime.Now.AddDays(1) } };
        public User FindUser(string userName, string password)
        {
            return _users.FirstOrDefault(_ => _.Name == userName && _.Password == password);
        }

        public List<User> Users
        {
            get
            {
                return _users;
            }
        }
    }
}
